<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/jsp/include.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>

<body>
	所有用户都可以访问！！！
	<sec:authentication property="name" />
	<sec:authentication property="authorities" var="authorities"
		scope="page" />
	<c:forEach items="${authorities}" var="authority">
		${authority.authority}
	</c:forEach>

	<c:url var="action" value="/staff/findByName.html" />
	<br>
	<br>
	当前评阅人：${reviewer.name }

	<table width="1000px" bordercolor='black' border='1'
		style="border-collapse: collapse">
		<tr>
			<td>题目</td>
			<td>指导教师</td>
			<td>评阅人 </td>
			
			<sec:authorize ifAnyGranted="ROLE_SCHOOL,ROLE_DEPARTMENT">
				<td colspan="2">操作</td>
			</sec:authorize>
		</tr>
		<c:forEach items="${projectList}" var="project" varStatus="i">
			<tr>
				
				<td>${project.title}</td>
				
				<td>
					<c:forEach items="${project.tutorial}" var="tutorial">
						${tutorial.tutor.name}
					</c:forEach>
				</td>
				<td>
					<c:forEach items="${project.reviewProject}" var="reviewProject">
						${reviewProject.reviewer.name}
					</c:forEach>
				</td>
				
				
				<sec:authorize ifAnyGranted="ROLE_DEPARTMENT">
				<td>
					<c:choose >
						<c:when test="${empty project.reviewProject}">  
						
								<!-- 当前评阅 人id/项目id/评阅关系的评阅人id-->
								<a href="../setReviewer/${reviewer.id}
									/${project.id}									
									.html?pageNo=${pageNo}">								
									建立评阅关系
								</a>	
			
						</c:when>
						<c:otherwise>
							<c:forEach items="${project.reviewProject}" var="reviewProject">
								<!-- 当前评阅 人id/项目id/评阅关系的评阅人id-->
								<a href="../breakReviewer/${reviewer.id}
									/${project.id}									
									/${reviewProject.reviewer.id}
									.html?pageNo=${pageNo}">								
									解除评阅关系
								</a>	
							</c:forEach>
												
						</c:otherwise>
					</c:choose>
				</td>						
				</sec:authorize>
			</tr>
		</c:forEach>
	</table>
	<totoro:PageBar pageUrl="/departmentLeader/listProjectForReviewer.html" pageAttrKey="pagedPost" />
	<p>
		<a href="<c:url value="../j_spring_security_logout"/>">Logoff</a>
		(also clears any remember-me cookie)
</body>
</html>